package com.wbp.cms.qatest.service;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;

import javax.annotation.Resource;

import org.junit.Test;

import com.wbp.cms.core.service.image.ImageUploadYunManager;
import com.wbp.cms.core.util.ImageUploadUtil;
import com.wbp.cms.qatest.BaseTest;


/**
 * @Description: 
 * @Department:
 * @author andy.lhc
 * @date 2016年3月25日 上午10:44:26 
 */
public class ImageUploadTest extends BaseTest {
   
  @Resource(name="imageUploadYunManager")
  private ImageUploadYunManager  imageUploadYunManager ;
  
  @Test
  public void test_upload001(){
    
      File  f = new File("d:\\wglogo.png");
      FileInputStream  fis = null ;
      try {
          System.out.println( f.getName() );
          fis = new FileInputStream(f) ; 
          Map<String,String> map = this.imageUploadYunManager.getUploadYunService().uploadFile(fis, ImageUploadUtil.getTime()+f.getName()) ; 
          System.out.println(map); 
          
      } catch (IOException e) {
          e.printStackTrace();
      }finally{
           try {
            fis.close();
          } catch (IOException e) {
            e.printStackTrace();
          } 
      }
      
      
  }
  
  
  
}
